<!DOCTYPE html>
<html>
<head>
  <title>文章管理 - {$sys_config['site_name']}</title>
  {include file="public/head" /}
</head>
<body class="hold-transition skin-blue sidebar-mini fixed">
<div class="wrapper">

  {include file="public/nav" /}
  {include file="public/menu" /}

  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1>
        文章管理
      </h1>
      <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i> 控制台</a></li>
        <li class="active">文章管理/li>
      </ol>
    </section>

    <!-- Main content -->
    <section class="content container-fluid">

      <div class="row" >
        <div class="col-xs-12">
          <!-- form start -->
            <form class="form-horizontal" style="background: #fff">
              <div class="box-body">
              <div class="row">
                <div class="col-xs-7">
                  <div class="form-group">
                     
                    <div class="col-sm-12">
                      <input type="text" class="form-control" name="key" placeholder="输入模板名称">
                    </div>
                  </div>
                </div>
                <div class="col-xs-5">
                  <button type="submit" class="btn btn-info">搜索</button>
                </div>
              </div>
              </div>
            </form> 
            <!-- /.box-header -->
          <div class="box">
            <div class="box-body">
              <table id="example1" class="table table-bordered table-striped">
                <thead>
                <tr>
                  <th style=" width: 120px;">操作</th>
                  <th>ID</th>
                  <th>文章标题</th>
                  <th>文章分类</th>
                  <th>浏览次数</th>
                  <th>点赞次数</th>
                  <th>文章来源</th>
                  <!-- <th style=" width: 40%;">文章内容</th> -->
                  <th>发布状态</th>
                  <th>创建时间</th>
                  <th>更新时间</th>
                </tr>
                </thead>
                <tbody>
                
                <tr>
                  <td colspan="100"><small class="btn btn-primary btn-xs open_attr_box" article-id="0" onclick="location='{:url('Article/add')}'"><i class="fa fa-plus"></i> 添加文章</small></td>
                </tr>
                {foreach name="list" item="vo"}
                <tr>
                  <td>
                    <small class="btn btn-primary open_attr_box btn-xs edit_tel" article-id="{$vo.article_id}"><i class="glyphicon glyphicon-edit"></i> 编辑</small>
                    <small class="btn btn-danger btn-xs del_dept" article-id="{$vo.article_id}"><i class="fa fa-clock-o"></i> 删除</small></td>
                  <td>{$vo.article_id}</td>
                  <td>{$vo.post_title}</td>
                  <td>{$vo.article_id}</td>
                  <td>{$vo.post_hits}</td>
                  <td>{$vo.post_like}</td>
                  <td>{$vo.post_source}</td>
                  <!-- <td>{$vo.post_content}</td> -->
                  <td>{$vo.status}</td>
                  <td>{$vo.dt}</td>
                  <td>{$vo.uptime}</td>
                </tr>
                {/foreach}
                </tbody>
              </table>
              <div class="pull-right"></div>
            </div>

            <!-- /.box-body -->
          </div>
          <!-- /.box -->
        </div>
      </div>
    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->

  {include file="public/foot" /}
</div>
<!-- ./wrapper -->
{include file="public/js" /}
</body>
<script type="text/javascript">
$(function () {
    //新加联系人
    $(".edit_tel").click(function() {
        var article_id = $(this).attr('article-id');
        window.location.href = "{:url('Article/edit')}?article_id="+article_id;
    });
});

layui.use('layer', function(){
    //删模板
  $('.del_dept').click(function () {
    var article_id = $(this).attr('article-id');
    var msg = "确定删除此模板吗？";
    layer.confirm(msg,{
      btn: ['确定','取消'] //按钮
      }, function(){
        $.post("{:url('Article/delTemp')}", {article_id:article_id},function(res){
              if (res.status==1){
                layer.msg(res.msg,function(index, layero){
                  location.reload();
                });
                
                return false;
              }else{
                layer.msg(res.msg);
                return false;
              }
        }, "json");

      });
                
  });
});
</script>
</html>